# Maintainer: AndyRTR <andyrtr@archlinux.org>
# Contributor: Jan de Groot <jgc@archlinux.org>

pkgname=xorg-fonts-misc
pkgver=1.0.4
pkgrel=1
pkgdesc="X.org misc fonts"
arch=(any)
url="https://xorg.freedesktop.org/"
license=('custom')
depends=('xorg-fonts-alias-misc')
makedepends=('xorg-util-macros' 'xorg-mkfontscale' 'xorg-bdftopcf' 'xorg-font-util')
provides=('font-misc-ethiopic' 'font-misc-meltho')
source=(${url}/releases/individual/font/font-arabic-misc-${pkgver}.tar.xz{,.sig}
        ${url}/releases/individual/font/font-cursor-misc-${pkgver}.tar.xz{,.sig}
        ${url}/releases/individual/font/font-daewoo-misc-${pkgver}.tar.xz{,.sig}
        ${url}/releases/individual/font/font-dec-misc-${pkgver}.tar.xz{,.sig}
        ${url}/releases/individual/font/font-isas-misc-${pkgver}.tar.xz{,.sig}
        ${url}/releases/individual/font/font-jis-misc-${pkgver}.tar.xz{,.sig}
        ${url}/releases/individual/font/font-micro-misc-${pkgver}.tar.xz{,.sig}
        ${url}/releases/individual/font/font-misc-ethiopic-1.0.5.tar.xz{,.sig}
        ${url}/releases/individual/font/font-misc-meltho-${pkgver}.tar.xz{,.sig}
        ${url}/releases/individual/font/font-misc-misc-1.1.3.tar.xz{,.sig}
        ${url}/releases/individual/font/font-mutt-misc-${pkgver}.tar.xz{,.sig}
        ${url}/releases/individual/font/font-schumacher-misc-1.1.3.tar.xz{,.sig}
        ${url}/releases/individual/font/font-sony-misc-${pkgver}.tar.xz{,.sig}
        ${url}/releases/individual/font/font-sun-misc-${pkgver}.tar.xz{,.sig})
sha512sums=('afd5fae32440b133c5ee0195af44ad1462d35c2f451dcf4b1c93e0ce245d009b120d39eb5f780b003ae2f572408965e6d149437e9ebbf5738cb69193aaa4d488'
            'SKIP'
            '22bd86a81cdfb1e17f885dc3961071c08920171a6f0736ae52d95c8e576b1debc7570aa3b7e1007f474b50435fba411f0eb1847894e8b52f6e6268d91cf9f2db'
            'SKIP'
            'be9f550e8cb84f9e24afb6b739c357cb159da8a06f8bc2c26c9fbb62320427dd7522e04d10492cec91ab559b2e5dd5067012ff3225695a8337f1cd7db9801f57'
            'SKIP'
            'bf6c0e4924835346f1f7913a04fa3903a7c55d292317526dd8eaa799dfb3b52eb2157c34692d659b41a18123af8389785dcb4aa0c31fc387cb368642801c3335'
            'SKIP'
            '7c8cc9083600949fff4a0373f9f22df80f6a2c97d8d56bc2c4d03b102d16ad071b984b1ecf547d2d17ede9335e5c3a418512631a18938b7728c66b4339dcedd5'
            'SKIP'
            'c54034205e7bd7a01b311c25c890f9fd1abc25f842315812d5c83d4e4091e5e6c2125a43d4d532b88c79d51cb812b86cfa8e7e4c1a87175746f1bd4e38129440'
            'SKIP'
            'e9a402a5042eef0b618bc30b319256cae9f71f546c167c8b638a780f93cbdc2d61c472203efaee7077acedfac3b3981feefbc1017cfee8512077e61deff42ed3'
            'SKIP'
            '7732a828c005e3762b6383729134c5656fd575ac59288504d047fbe26e9965a80519a37b0cc4c6b89379a85a62160c5ea76017f790447a230c015aa7a9143ba0'
            'SKIP'
            '1391e24b0402f50dfa877d71305ef8c144c489b21db0fdab278668360eef7e5ebd4145d77f52b5fc7225895804f3fc7f0e67ad114d64cde073e642d7ae328a54'
            'SKIP'
            'fac4bfda0e4189d1a9999abc47bdd404f2beeec5301da190d92afc2176cd344789b7223c1b2f4748bd0efe1b9a81fa7f13f7037015d5d800480fa2236f369b48'
            'SKIP'
            '9cbc82e6a519572576cb60f4d6b9795468666d53ac7df17d6736ab04190cb5f58c8b57be61ab509fc9372e1114c6aaa5e0d098ec1fa63dc5d8638916614f7046'
            'SKIP'
            '83b25495535176a5e348269358ac34af8223023a55e2c5c599725ee90ec9ff3ea9ff19cca46b93eeae7ef985da325f9065c83d829a4a8c72d0c3c197242a1b64'
            'SKIP'
            'f361fca66db2ec80b1467fb6bff57bd2cfc6722473bd7ad119026a97552eef07ff77552c01eb8f98f3299d7fd40c8c2cb3e0d0b01adca2f81c2c2f75581dc113'
            'SKIP'
            '9eeb330c1190557479636119af8aeb49917f1faeaa42d3a93e35d318348ee4247405544107ce9f5a244dbe2c0001c8d34b604b961bd9d92431f84b992fe9739e'
            'SKIP')
validpgpkeys=('4A193C06D35E7C670FA4EF0BA2FB9E081F2D130E') # "Alan Coopersmith <alan.coopersmith@oracle.com>"

build() {
  cd "${srcdir}"
  for dir in *; do
    if [ -d "${dir}" ]; then
      pushd "${dir}"
      ./configure --prefix=/usr \
          --with-fontdir=/usr/share/fonts/misc
      make
      popd
    fi
  done
}

package() {
  cd "${srcdir}"
  install -m755 -d "${pkgdir}/usr/share/licenses/${pkgname}"
  for dir in *; do
    if [ -d "${dir}" ]; then
      pushd "${dir}"
      make DESTDIR="${pkgdir}" install
      install -m644 COPYING "${pkgdir}"/usr/share/licenses/${pkgname}/LICENSE.${dir%-*}
      popd
    fi
  done
  rm -f "${pkgdir}"/usr/share/fonts/*/fonts.*
  
  # move .otf files to proper directory - FS#44250
  mv "${pkgdir}"/usr/share/fonts/misc/*.otf "${pkgdir}"/usr/share/fonts/OTF/
}
